package controller.weapon
{
	import enums.weapon.WeaponViewSCPageIndex;
	
	import model.vo.weapon.FluteVo;
	import model.weapon.WeaponModel;
	
	import org.robotlegs.mvcs.StarlingCommand;
	
	import service.SQLService;
	
	import view.event.weapon.flute.FluteDetailViewEvent;
	import view.event.weapon.flute.FluteListViewEvent;
	import view.event.weapon.flute.FluteViewEvent;
	
	
	/**
	 * 请求获得笛子详细信息
	 * @author £iang
	 * 
	 */	
	public class GetFluteDetailCommand extends StarlingCommand
	{
		//-----------------------------
		// variables
		//-----------------------------
		
		/** sqlService */
		[Inject]
		public var sqlService:SQLService;
		/** weaponModel */
		[Inject]
		public var weaponModel:WeaponModel;
		
		//-----------------------------
		// properties
		//-----------------------------
		
		//-----------------------------
		// setter&getter
		//-----------------------------
		
		//-----------------------------
		// methods
		//-----------------------------
		
		/**
		 * 执行函数 
		 * 
		 */		
		override public function execute():void
		{
			var weaponData:FluteVo = 
				sqlService.getFluteDetailInfo( weaponModel.curSearchWeaponId );
			
			var fluteDetailEvent:FluteDetailViewEvent = 
				new FluteDetailViewEvent( FluteDetailViewEvent.SHOW_DETAIL );
			
			fluteDetailEvent.weaponVo = weaponData;
			dispatch( fluteDetailEvent );
			
			var fluteEvent:FluteViewEvent = 
				new FluteViewEvent( FluteViewEvent.CHANGE_PAGE );
			
			fluteEvent.newPage = WeaponViewSCPageIndex.DETAIL_PAGE;
			dispatch( fluteEvent );
			
			dispatch( new FluteListViewEvent( FluteListViewEvent.SCROLL_ITEM ) );
		}
		
		//-----------------------------
		// events
		//-----------------------------
		
		//-----------------------------
		// dispose
		//-----------------------------
		
		//-----------------------------
		// construction
		//-----------------------------
		
		/**
		 * 构造函数
		 *
		 */
		public function GetFluteDetailCommand()
		{
			super();
		}
	}
}